package org.scratchcrew.web.jsf;

import java.util.Locale;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

/**
 * This class contains various util methods for JSF.
 * 
 * @author mnedkov
 */
public class FacesUtils {
	/**
	 * Returns the label attribute of the given component.
	 */
	public static String getLabel(UIComponent component) {
		return (String) component.getAttributes().get("label");
	}

	public static Locale getLocale() {
		return FacesContext.getCurrentInstance().getViewRoot().getLocale();
	}
}
